package com.eshore.norm.pattern.flyweight;

import com.fasterxml.classmate.util.ConcurrentTypeCache;

import java.util.HashMap;
import java.util.Map;

/**
 * FlyWeightFactory 是享元工厂类，用于构建一个池容器(集合)，同时提供从池中获取对象的方法
 *
 * @author: v-chenjl62
 * @date: 2024/2/6 14:49
 */
public class BoxFactory {
    private static BoxFactory boxFactory=new BoxFactory();
    private  HashMap<String,AbstractBox> map ;

    private BoxFactory(){
        map = new HashMap<>();
        map.put("I",new IBox());
        map.put("L",new LBox());
        map.put("O",new OBox());
    }

    public static BoxFactory getInstance(){
      return boxFactory;

    }

    public AbstractBox getShape(String name){
        return map.get(name);

    }


}
